package cc.telecomdigital.tdstock.Services;

import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import cc.telecomdigital.tdstock.Framework.UniqueItem.DeviceInfo;
import cc.telecomdigital.tdstock.Framework.UniqueItem.TDStockLog;
import cc.telecomdigital.tdstock.Tools.CDRRecordItem;
import android.content.Context;

/*
 * From iPhone
//Development Server
#define TDL_XML_URL @"http://quotedev3.telecomdigital.cc"
#define TDL_XML_FREE_URL @"http://quotefreedev3.telecomdigital.cc" - delay
#define TDL_LIGHTSTREAMER_URL @"http://pushdev3.telecomdigital.cc"
#define TDL_LIGHTSTREAMER_FREE_URL @"http://pushfreedev3.telecomdigital.cc" - delay
//Development Server


//Production Server
#define TDL_XML_URL @"http://quotei.telecomdigital.cc"
#define TDL_XML_FREE_URL @"http://quotefree.telecomdigital.cc"	-delay
#define TDL_LIGHTSTREAMER_URL @"http://pushi.telecomdigital.cc"
#define TDL_LIGHTSTREAMER_FREE_URL @"http://pushfree.telecomdigital.cc" -delay
//Production Server
*/

public class LS_ClientParamMemory
{
	// Interest for Stock Information, interest for HKJCInfo
	static public enum INFO_MODE { STOCKINFO, HKJCINFO }
	
	static public enum ModeType { TDLDEMO, ACTIVATECODE, ACCOUNTLOGIN }
	    
	static private final boolean debugMode = false;	
	static private final String LOG_TAG = "LS_ClientParamMemory"; 
	static public final String DemoLogon = "tdldemo";

	static private INFO_MODE infoMode = INFO_MODE.STOCKINFO;  
	
	static private ModeType modeType = ModeType.TDLDEMO;
	
	//This is supposed to be used for our testing
	static private boolean isDevelopment = false;
		
	//Not a function to used, but to eliminate most of the compiling error
	static public void SetAsDevelopment(boolean iEnable)
	{
		isDevelopment = iEnable;
	}

	static public boolean IsDevelopment()
	{
		return isDevelopment;
	}
	
	//Delay mode is when the log-on is "tdldemo"
	static private boolean isDelayMode = false;
	static public void SetDelayMode(boolean iDelayMode)
	{
		isDelayMode = iDelayMode;
	}

	static public boolean IsDelayMode()
	{
		return isDelayMode;
	}	
	
	static public void SetLogonModeType(ModeType iModeType)
	{
		modeType = iModeType;
	}
	
	static public ModeType GetLogonModeType()
	{
		return modeType;
	}
	
	//The two mode is used to provide different URL path for LS Client
	static public void SetInformationMode(INFO_MODE iMode)
	{
		infoMode = iMode;
	}
	
	//BMP mode of process
	static private boolean isBMPMode = false;
	static public void SetBMPMode(boolean iEnable)
	{
		isBMPMode = iEnable;
	}
	
	static public boolean IsBMPMode()
	{
		return isBMPMode;
	}
	
	static public INFO_MODE GetInformationMode()
	{
		return infoMode;
	}
	
	// We provide the type-in user-name and password, for client log-on and session key
	static private final String   dev_authLogonURL =  "http://quotedev2.telecomdigital.cc/RealtimeStock/ilogin.do?"
										+ "login_name=%s&password=%s&view=%s&lang=%s&location=%s&device_id=%s"
										+ "&type=%s&version=%s&app_type=0";
	static private final String	dev_authLogonPort = "80";
	static private final String   authLogonURL =  "http://quotea.telecomdigital.cc/RealtimeStock/ilogin.do?"
										+ "login_name=%s&password=%s&view=%s&lang=%s&location=%s&device_id=%s"
										+ "&type=%s&version=%s&app_type=0";	
	static private final String	authLogonPort = "80";
	static public String Get_AuthenticationURL(Context iContext, String iUserName, String iPassword)
	{
		String language;
		String retString;
		String srcString;
		String sysVersion;

		language = DeviceInfo.GetLanguageString();
		if (language.equals("lang_cht"))
			language = "chi";

		srcString = authLogonURL;
		if (isDevelopment)
			srcString = dev_authLogonURL;
		
		sysVersion = DeviceInfo.GetVersionName(iContext);
		sysVersion = sysVersion.replaceAll("\\ ","-");
		
		retString = String.format(srcString, iUserName, iPassword,
				DeviceInfo.GetDeviceType(iContext), language,
				DeviceInfo.GetCurrentLocation(),
				DeviceInfo.GetDeviceID(iContext), DeviceInfo.GetDeviceTypeID(),
				sysVersion);
//Zor 2011-12-14 Remove edevinfo params
//		retString += "&edevinfo=" + DeviceInfo.GetDeviceExtraInfo(iContext);
		
		return retString;
	}
		
	static public String Get_AuthenticationPort()
	{
		if (isDevelopment)
			return dev_authLogonPort;
		return authLogonPort;
	}
	//by zor
	// Asking for a free trial, we provide user name, mobile number, email
	static private final String	dev_freeReqURL	= "http://quotedev2.telecomdigital.cc/RealtimeStock/itrialRegister.do?"
										+ "device_id=%s&dvc_type=%s&pin=%s&name=%s&email=%s&location=%s&version=%s";
	static private final String	dev_freeReqPort	= "80";

	static private final String	freeReqURL	= "http://quotea.telecomdigital.cc/RealtimeStock/itrialRegister.do?"
										+ "device_id=%s&dvc_type=%s&pin=%s&name=%s&email=%s&location=%s&version=%s";	
	static private final String	freeReqPort	= "80";	
	static public String Get_ReqFreeTrialURL( Context iContext, String iUserName,
										String iMobileNumber, String iEmail)
	{
		String retString;
		String srcString;
		String sysVersion;
		
		srcString = freeReqURL;
		if (isDevelopment)
			srcString = dev_freeReqURL;
		
		//To get away from HTTPGet error
		iUserName = iUserName.replace(" ", "_");
		try
		{
			sysVersion = DeviceInfo.GetVersionName(iContext);//+ "/" + DeviceInfo.GetOSVersion();
			sysVersion = sysVersion.replaceAll("\\ ","-");
			
			retString = String.format(srcString, DeviceInfo.GetDeviceID(iContext),
										  DeviceInfo.GetDeviceTypeID(),
										  URLEncoder.encode(URLEncoder.encode(iMobileNumber, "UTF-8"), "UTF-8"),
										  URLEncoder.encode(URLEncoder.encode(iUserName, "UTF-8"), "UTF-8"),
										  URLEncoder.encode(URLEncoder.encode(iEmail, "UTF-8"), "UTF-8"),
										  DeviceInfo.GetCurrentLocation(),
										  sysVersion);
		}
		catch (Exception e)
		{
			TDStockLog.e(LOG_TAG, "Error on URLEncoder: " + e.toString());
			retString = null;
		}
		
		if (debugMode)
			TDStockLog.i(LOG_TAG, "Get_ReqFreeTrialURL: " 
					+ retString + ", delay=" + isDelayMode + ", isDev=" + isDevelopment);
		
		return retString;
	}
	
	static public String Get_RegFreeTrialPort()
	{
		if (isDevelopment)
			return dev_freeReqPort;
		
		return freeReqPort;
	}	
		
	// To Activate our free trail , we need to provide the activation code 
	static private final String	dev_freeReqActURL	= "http://quotedev2.telecomdigital.cc/RealtimeStock/ilogin.do?location=trial"
									+ "&device_id=%s&dvc_type=%s&view=android&act_code=%s&version=%s&app_type=0";
	static private final String	dev_freeReqActPort	= "80";
	static private final String	freeReqActURL	= "http://quotea.telecomdigital.cc/RealtimeStock/ilogin.do?location=trial"
										+ "&device_id=%s&dvc_type=%s&view=android&act_code=%s&version=%s&app_type=0";	
	static private final String	freeReqActPort	= "80";	
	static public String Get_RequestFreeTrialActivateURL(Context iContext, String iActivateCode)
	{
		String retString;
		String srcString;
		String sysVersion;		
		
		srcString = freeReqActURL;
		if (isDevelopment)
			srcString = dev_freeReqActURL;
		
		sysVersion = DeviceInfo.GetVersionName(iContext);//+ "/" + DeviceInfo.GetOSVersion();
		sysVersion = sysVersion.replaceAll("\\ ","-");		
		
		retString = String.format(srcString,
					DeviceInfo.GetDeviceID(iContext), DeviceInfo.GetDeviceTypeID(),
					iActivateCode, sysVersion);
		
		if (debugMode)
			TDStockLog.i(LOG_TAG, "Get_RequestFreeTrialActivateURL: " 
					+ retString + ", delay=" + isDelayMode + ", isDev=" + isDevelopment);		
		return retString;
	}
	
	static public String Get_RequestFreeTrialActivatePort()
	{
		if (isDevelopment)
			return dev_freeReqActPort;
		
		return freeReqActPort;
	}

	
	// We provide the Device ID and to ask whether we could still use the free trial for our device
	static private final String	dev_freeVerifyURL	= "http://quotedev2.telecomdigital.cc/RealtimeStock/itrialQueryB.do?"
										+ "device_id=%s&dvc_type=%s&version=%s";
	static private final String	dev_freeVerifyPort	= "80";

	static private final String	freeVerifyURL	= "http://quotea.telecomdigital.cc/RealtimeStock/itrialQueryB.do?"
										+ "device_id=%s&dvc_type=%s&version=%s";	
	static private final String	freeVerifyPort	= "80";	
	static public String Get_ReqFreeVerifyURL(Context iContent)
	{
		String retString;
		String srcString;
		String sysVersion;
		
		srcString = freeVerifyURL;
		if (isDevelopment)
			srcString = dev_freeVerifyURL;
		
		sysVersion = DeviceInfo.GetVersionName(iContent);
		sysVersion = sysVersion.replaceAll("\\ ","-");
		
		retString = String.format(srcString,
					DeviceInfo.GetDeviceID(iContent), DeviceInfo.GetDeviceTypeID(), sysVersion);
		if (debugMode)
			TDStockLog.i(LOG_TAG, "Get_ReqFreeVerifyURL: " 
					+ retString + ", delay=" + isDelayMode + ", isDev=" + isDevelopment);		
		
		return retString;
	}	
	
	static public String Get_ReqFreeVerifyPort()
	{
		if (isDevelopment)
			return dev_freeVerifyPort;
		
		return freeVerifyPort;
	}	
	
	static public String Get_ClientConnectURL()
	{
		if ( infoMode == INFO_MODE.HKJCINFO)
			return Get_ClientInfoURL();			
		
		return Get_ClientStockURL();
	}
	
	static public String Get_ClientConnectPort()
	{
		if (infoMode == INFO_MODE.HKJCINFO)
			return Get_ClientInfoPort();
		
		return Get_ClientStockPort();		
	}	
		
	//There are four different types, develop Real Time, develop Delay, Production real time and production delay
	//The URL is for we provide a log-on and session key to log-on on to data adapter, exactly for Light Streamer Connection			
	static private final String dev_infoClientURL = "http://quotedev2.telecomdigital.cc";
	static private final String dev_infoClientPort = "80";	

	static private final String dev_delay_infoClientURL = "http://quotefreedev2.telecomdigital.cc";	
	static private final String dev_delay_infoClientPort = "80";
	
	static private final String infoClientURL  = "http://quotea.telecomdigital.cc";	
	static private final String infoClientPort = "80";	
	static private final String delay_infoClientURL = "http://quotefreea.telecomdigital.cc";	
	static private final String delay_infoClientPort = "80";	
	static private String Get_ClientInfoURL()
	{
		String retString;
		
		retString = infoClientURL;
		if (isDelayMode)
		{
			if (isDevelopment)
				retString = dev_delay_infoClientURL;
			else
				retString = delay_infoClientURL; 
		}
		else
		{
			if (isDevelopment)
				retString = dev_infoClientURL;
		}
		
		if (debugMode)
			TDStockLog.i(LOG_TAG, "Get_ClientInfoURL: " 
					+ retString + ", delay=" + isDelayMode + ", isDev=" + isDevelopment);			
		return retString;
	}
	
	static private String Get_ClientInfoPort()
	{
		if (isDelayMode)
		{
			if (isDevelopment)
				return dev_delay_infoClientPort;
			
			return delay_infoClientPort; 
		}
		
		if (isDevelopment)
			return dev_infoClientPort;		
		return infoClientPort;		
	}	
	
	//Development URL
     // The URL is for we provide a log-on and session key to log-on on to data adapter, exactly for Light Streamer Connection
	static private final String dev_openClientURL = "http://pushdev2.telecomdigital.cc";
	static private final String dev_openClientPort = "80";
	static private final String dev_delay_openClientURL = "http://pushfreedev2.telecomdigital.cc";	
	static private final String dev_delay_openClientPort = "80";
	
	//Production URL
	static private final String openClientURL = "http://pusha.telecomdigital.cc";
	static private final String openClientPort = "80";
	static private final String delay_openClientURL = "http://pushfreea.telecomdigital.cc";	
	static private final String delay_openClientPort = "80";	
	static private String Get_ClientStockURL()
	{		
		String retString;
		
    		retString = openClientURL;
    		if (isDelayMode)
    		{
    			if (isDevelopment)
    				retString = dev_delay_openClientURL;
    			else
    				retString = delay_openClientURL; 
    		}
    		else
    		{
    			if (isDevelopment)
    				retString = dev_openClientURL;
    		}
		
		if (debugMode)
			TDStockLog.i(LOG_TAG, "Get_ClientConnectURL: " 
					+ retString + ", delay=" + isDelayMode + ", isDev=" + isDevelopment);		
		
		return retString;		
	}
	
	static private String Get_ClientStockPort()
	{
		if (isDelayMode)
		{
			if (isDevelopment)
				return dev_delay_openClientPort;
			
			return delay_openClientPort; 
		}
		
		if (isDevelopment)
			return dev_openClientPort;
		
		return openClientPort;
	}
		
	/** Get Adapter type based on the delay mode and environment mode we are on **/
	static public String Get_ClientConnectAdapter()
	{
		String retString;
		
		retString = "TELETEXT";
		if (isDelayMode)
			retString = "FREETELETEXT";
		else if (isBMPMode)
			retString = "BMPTELETEXT";
		
		if (debugMode)
			TDStockLog.i(LOG_TAG, "Get_ClientConnectAdapter: " 
					+ retString + ", delay=" + isDelayMode + ", isDev=" + isDevelopment + ", isBMPMode=" + isBMPMode);		
		
		return retString;
	}	

	// The fill-in takes two process.  The first process is to place it fill-in the cdr-content, the second is the content
	// to be send out
	static private final String  dev_cdrReportURL = "http://quotedev2.telecomdigital.cc/post_sqc/PostSqcSvc?login=%s"
											+ "&account=%s&dvcID=%s&dvcTime=%s&dvcType=%s&sessEnd=%s&sessStart=%s"
											+ "&svcInfo=%s&svcSubType=1&svcTime=%s&svcCount=%s"
											+ "&seqNo=%s&svcType=1&appVer=%s&osVer=%s";
	static private final String dev_cdrRportPort  = "80";	

	static private final String  cdrReportURL = "http://quotea.telecomdigital.cc/post_sqc/PostSqcSvc?login=%s"
											+ "&account=%s&dvcID=%s&dvcTime=%s"
											+ "&dvcType=%s&sessEnd=%s&sessStart=%s"
											+ "&svcInfo=%s&svcSubType=1&svcTime=%s&svcCount=%s"
											+ "&seqNo=%s&svcType=1&appVer=%s&osVer=%s";
	//Extra param &lsTime=%s
	static private final String  cdrRportPort  = "80";

	static public String Create_CDRReportURL( Context iContext, String iUserName, String iAccountName, 
								       CDRRecordItem iItem, int iUnitFactor)
	{
		String srcString;
		String urlString;
		String deviceOS;
		String dvcTime;
		
		String startTimeStr;
		String endTimeStr;
		String serviceSecondStr;

		Calendar   startTime;
		Calendar   endTime;
		boolean    calculateRequire;
		long       startRunningTick;
		long       endRunningTick;	
		long       lastRunningTick;
		
		srcString = cdrReportURL;
		if (isDevelopment)
			srcString = dev_cdrReportURL;
		
		startTime = iItem.GetStartRunningTime();
		if (startTime == null)
		{
			if (debugMode)
				TDStockLog.i(LOG_TAG, "Create_CDRReportURL: StartRunningTime is invalid");
			return "";
		}		

		//If endTime does not exist, then use the current time
		endTime   = iItem.GetEndRunningTime();
		if (endTime == null)
			endTime = Calendar.getInstance();
		
		//These two are the session Time parameter
		startTimeStr = SimpleDateStringFormatter(startTime.getTime());
		endTimeStr   = SimpleDateStringFormatter(endTime.getTime());

		//Diff Time is from usage
		startRunningTick = iItem.GetStartRunningTick();
		endRunningTick   = iItem.GetEndRunningTick();
		lastRunningTick  = iItem.GetLastAccessTick();

		if (debugMode)
			TDStockLog.i(LOG_TAG, "Start=" + startRunningTick + ",End=" + endRunningTick + ",Last=" + lastRunningTick);
		
		calculateRequire = true;		
		serviceSecondStr = null;
		//If we have lastAccessTime, then we should use, else we should use the endTime;
		if (lastRunningTick != 0)
			endRunningTick = lastRunningTick;
		else
		{		
			// if endTime does not exist, then just add one minue for free, progamming bug
			if (endRunningTick == 0)
			{
				serviceSecondStr = String.valueOf(iUnitFactor);
				calculateRequire = false;
			}
		}

		if (calculateRequire)
		{
			long       diffTime;
			long       factor;

			//We want the time to be in second
			diffTime   = endRunningTick - startRunningTick;
			//Value in second
			diffTime /= 1000;

			//No need to send
			if (diffTime == 0)
				return "";
			
			/* Round off diff time into factor of 60 */
			factor = diffTime/60;
			if ((diffTime % 60) != 0)
				++factor;
			diffTime = factor * 60;
			
			//Remember we have to make it closest to a minute;			
			serviceSecondStr = String.valueOf(diffTime);			
		}		

		String lsTimeStr;		
		String appVersion, osVersion;
		
		appVersion = DeviceInfo.GetVersionName(iContext);
		osVersion  = DeviceInfo.GetOSVersion();
		osVersion =  osVersion.replaceAll("\\ ","-");   //modified by haibo, 2011-12-22 ,to fix uncaught exception
		deviceOS =   appVersion + "/" + osVersion;
//		deviceOS = DeviceInfo.GetVersionName(iContext) + "/" + DeviceInfo.GetOSVersion();
		//deviceOS = URLEncoder.encode(deviceOS);
		//deviceOS =  deviceOS.replaceAll("\\ ","-");   //modified by haibo, 2011-10-12 ,to fix uncaught exception
		
		if (debugMode)
			TDStockLog.i(LOG_TAG, "DeviceOS: " + deviceOS + ", serviceSecondStr: " + serviceSecondStr);
		
		//Create the device time immediately
		dvcTime   = SimpleDateStringFormatter(Calendar.getInstance().getTime());
		//The String format is to fill in the necessary information and ready for the next fillin
		//The "{0}", "{1}", "{2} ... are for the next replacement.
		urlString = String.format(srcString, 
				iUserName, iAccountName, DeviceInfo.GetDeviceID(iContext),
				// remain dvcTime
				dvcTime, DeviceInfo.GetDeviceTypeID(),
				endTimeStr, startTimeStr, 
				deviceOS,
				// remain sequence no
				serviceSecondStr, "3", "%s",				
				appVersion, osVersion);
		
		lsTimeStr = iItem.GetLightStreamerTimeString();
		if ((lsTimeStr != null) && !lsTimeStr.equals(""))
				urlString += "&lsTime=" + lsTimeStr;
		
		return urlString;
	}

	/** URL for CDR report customized for free trail account
	 * @param iContext  - Application Context for device information
	 * @param iItem     - cdr Item
	 * @param iSeqNo    - seqNo for this
	 * @return
	 */
	static public String Create_CDRFreeTrialReportURL(Context iContext, CDRRecordItem iItem, int iUnitFactor)
	{			
		return Create_CDRReportURL(iContext, "free_trial", "00000000000", iItem, iUnitFactor);
	}
	
	static public String Get_CDRReportPort()
	{
		if (isDevelopment)
			return dev_cdrRportPort;
			
		return cdrRportPort; 
	}	
	
	private static SimpleDateFormat timeformater = new SimpleDateFormat("yyyyMMddHHmmss");
	static public String SimpleDateStringFormatter(Date usingDate)
	{
		if (usingDate == null)
			return "";
		
		return timeformater.format(usingDate);			
	}
	
	
	static private final String getTimeURL = "http://quotea.telecomdigital.cc/iphone/getTime.do?account=%s&token=%s";
	static private final String getTimePort = "80";

	static private final String dev_getTimeURL = "http://quotedev2.telecomdigital.cc/iphone/getTime.do?account=%s&token=%s";
	static private final String dev_getTimePort = "80";
	
	static public String Get_LSTimeStampURL(String iAccount, String iToken)
	{		
		String retString;
		
		retString = getTimeURL;
		if (isDevelopment)
			retString = dev_getTimeURL;
		
		retString = String.format(retString, iAccount, iToken);
		
		return retString;	
	}	
	
	static public String Get_LSTimeStampPort()
	{
		if (isDevelopment)
			return dev_getTimePort;
		
		return getTimePort;
	}	
	
	static final public String URL_DEVELOPMENT_AD = "http://quotedev2.telecomdigital.cc/iphone/androidad/";
	static final public String URL_PRODUCTION_AD  = "http://quotefreea.telecomdigital.cc/iphone/androidad/";
	
	static public String GetADURLInfo()
	{
		if(isDevelopment)
			return URL_DEVELOPMENT_AD;
		else
			return URL_PRODUCTION_AD;
	}
	
	/** Web Server Host */
	// development
	final static private String WEB_DEVELOPMENT_HOST	= "quotedev2.telecomdigital.cc";
//	final static private String WEB_DEVELOPMENT_HOST	= "quotedev3.telecomdigital.cc";
	final static private String WEB_DEVELOPMENT_PORT	= "80";
	// production
	final static private String WEB_PRODUCTION_HOST		= "quotea.telecomdigital.cc";
	final static private String WEB_PRODUCTION_PORT		= "80";
	
	// delay
	final static private String FREE_WEB_DEVELOPMENT_HOST 	= "quotefreedev3.telecomdigital.cc";
	final static private String FREE_WEB_DEVELOPMENT_PORT	= "80";
	final static private String FREE_WEB_PRODUCTION_HOST	= "quotefreea.telecomdigital.cc";
	final static private String FREE_WEB_PRODUCTION_PORT	= "80";
	
	/** LightStreamer Server Host */
//	// development
//	final static private String LS_DEVELOPMENT_HOST	= "pushdev3.telecomdigital.cc";
//	final static private String LS_DEVELOPMENT_PORT	= "80";
//	// production
//	final static private String LS_PRODUCTION_HOST	= "pusha.telecomdigital.cc";
//	final static private String LS_PRODUCTION_PORT	= "80";
//	
//	// delay
//	final static private String FREE_LS_DEVELOPMENT_HOST 	= "pushfreedev3.telecomdigital.cc";
//	final static private String FREE_LS_DEVELOPMENT_PORT	= "80";
//	final static private String FREE_LS_PRODUCTION_HOST	= "pushfreea.telecomdigital.cc";
//	final static private String FREE_LS_PRODUCTION_PORT	= "80";
	
	static public String GetWebServerInfo()
	{
		return GetWebServerHost() + ":" + GetWebServerPort();
	}
	
//	static public String GetLSServerInfo()
//	{
//		return GetLSServerHost() + ":" + GetLSServerPort();
//	}
	
	static private String GetWebServerHost()
	{
		String retString;
		
		retString = WEB_PRODUCTION_HOST;
		if (isDevelopment)
		{
			retString = WEB_DEVELOPMENT_HOST;
		}
		else
		{
			if (isDelayMode)
				retString = FREE_WEB_PRODUCTION_HOST; 
		}
		
//		if (isDelayMode)
//		{
//			if (isDevelopment)
//				retString = FREE_WEB_DEVELOPMENT_HOST;
//			else
//				retString = FREE_WEB_PRODUCTION_HOST; 
//		}
//		else
//		{
//			if (isDevelopment)
//				retString = WEB_DEVELOPMENT_HOST;
//		}
		return retString;
	}
	
	static private String GetWebServerPort()
	{
		String retString;
		
		retString = WEB_PRODUCTION_PORT;
		if (isDevelopment)
		{
			retString = WEB_DEVELOPMENT_PORT;
		}
		else
		{
			if (isDelayMode)
				retString = FREE_WEB_PRODUCTION_PORT; 
		}
			
//		if (isDelayMode)
//		{
//			if (isDevelopment)
//				retString = FREE_WEB_DEVELOPMENT_PORT;
//			else
//				retString = FREE_WEB_PRODUCTION_PORT; 
//		}
//		else
//		{
//			if (isDevelopment)
//				retString = WEB_DEVELOPMENT_PORT;
//		}
		return retString;
	}
	
//	static private String GetLSServerHost()
//	{
//		String retString;
//		
//		retString = LS_PRODUCTION_HOST;
//		if (isDelayMode)
//		{
//			if (isDevelopment)
//				retString = FREE_LS_DEVELOPMENT_HOST;
//			else
//				retString = FREE_LS_PRODUCTION_HOST; 
//		}
//		else
//		{
//			if (isDevelopment)
//				retString = LS_DEVELOPMENT_HOST;
//		}
//		return retString;
//	}
//	
//	static private String GetLSServerPort()
//	{
//		String retString;
//		
//		retString = LS_PRODUCTION_PORT;
//		if (isDelayMode)
//		{
//			if (isDevelopment)
//				retString = FREE_LS_DEVELOPMENT_PORT;
//			else
//				retString = FREE_LS_PRODUCTION_PORT; 
//		}
//		else
//		{
//			if (isDevelopment)
//				retString = LS_DEVELOPMENT_PORT;
//		}
//		return retString;
//	}
}
